<?php

namespace App\Http\Controllers\admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
class IssueController extends Controller
{	
   /**
   *    getIssue
   *    问题列表
   *    
   *    $data
   *    提取信息
   *    
   */
    public function getIssue(Request $request)
    {	
 
        //获取topic表信息
       $res = $request->all();
       $id=$res['tid'];

        //提取信息
        $data = DB::table('issue')
            ->join('topic', 'issue.tid', '=', 'topic.id')
            ->select('issue.*')
            ->where('tid','=',$id)
            ->paginate(3);
            // dd($data);
    	//显示列表页
        return view('/admin/issue/issue',['data'=>$data,'res'=>$res]);
    }

    /**
    *   getDel
    *   删除操作
    *   @ruturn $res
    */
    public function getDel(request $request)
    {
        
       //接受数据
        $id = $request->input('id');
        //执行删除
        $res = DB::table('issue')->where('id','=',$id)->delete();
        // dd($res);

        if($res){
            return back()->with('success','用户删除成功');
        }else{
            return back()->with('error','用户删除失败');
        }
    }

}
